package com.ling.module1sbbyyds.config;

import com.ling.module1sbbyyds.interceptor.UserInfoInterceptor;
import com.ling.module1sbbyyds.interceptor.UserLoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 天道酬勤、学无止境
 *
 * @Description: 类描述
 * @author: ling
 * @date: 2022年03月25日
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Autowired
    private UserLoginInterceptor userInterceptor;

    @Autowired
    private UserInfoInterceptor userInfoInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(userInterceptor).addPathPatterns("/api/**/isLogin/**");
        registry.addInterceptor(userInfoInterceptor).
                addPathPatterns("/api/communityPosts/getCommunityPostsList", "/api/communityPosts/getPostDetail/**",
                        "/api/comment/queryComment", "/api/video/getVideoList",  "/api/video/comment/queryComment");

    }



}
